<template>
	<view class="doctor-inquiry-order-wrap" @click="gotoRouter('/pages-doctor/orderInfo/orderInfo?id='+data.id)">
		<view class="doctor-inquiry-order-item">
			<view class="outer4">
				<image :src="data.avatar" class="mod4"></image> 
				<view  class="word4" >{{data.patientName}}</view>
				<view  class="word5" >{{rangeSex[data.sex].text}} &nbsp;&nbsp;{{data.age}}岁</view>		
				<!-- 待支付 -->
				<view class="info2 info2-red" v-if="data.oStatus==3">{{ orderStatusList[data.oStatus] }}</view>
				<!-- 待接诊 -->
				<view class="info2 info2-red" v-else-if="data.oStatus==1&&data.qStatus==0">{{ qStatusList[data.qStatus] }}</view>
				<!-- 问诊中 -->
				<view class="info2 info2-green" v-else-if="data.qStatus==1">{{ qStatusList[data.qStatus] }}</view>
				<!-- 已开处方 -->
				<view class="info2 info2-green" v-else-if="data.qStatus==2">{{ qStatusList[data.qStatus] }}</view>
				<!-- 已退诊 -->
				<view class="info2 info2-gray" v-else-if="data.qStatus==4">{{ qStatusList[data.qStatus] }}</view>
				<!-- 退款中|已退款 -->
				<view class="info2 info2-gray" v-else-if="data.oStatus==4||data.oStatus==5">{{ orderStatusList[data.oStatus] }}</view>
				<!-- 待发货|待收货 -->
				<view class="info2 info2-purple" v-else-if="data.oStatus==7||data.oStatus==8">{{ orderStatusList[data.oStatus] }}</view>
				<!-- 已完成 -->
				<view class="info2 info2-gray" v-else-if="data.oStatus==1||data.qStatus==3">{{ qStatusList[data.qStatus] }}</view>
				<!-- 其他状态 -->
				<view class="info2 info2-purple" v-else >{{ orderStatusList[data.oStatus] }}</view>
				
			</view>
		
			<view  class="paragraph1">
				订单类型：{{ orderTypeList[data.orderType].name }}-{{ inquiryTypeList[data.inquiryType].name }}
			</view>
			<view  class="paragraph1">
				病情描述：{{ data.content }}
			</view>
			<view class="outer6">
				<view class="txt2">{{ data.createdTime }}</view>
				<!--
				<view class="info3 info3-purple" v-if="data.oStatus==1&&data.qStatus==1" @click.stop="gotoRouter('/pages-im/chatRoom/chatRoom?accid=' + data.userId + '&role=1&questionOrderId='+data.id)">继续问诊</view>
				-->
				<view v-if="data.qStatus==1||data.qStatus==2" @click.stop="onEnd" class="info3 info3-purple" >结束问诊</view>
				<view class="info3 info3-purple" v-if="data.oStatus==1&&data.qStatus==1" @click.stop="gotoRouter('/pages-txy-im/chatRoom/chatRoom?accid=' + data.userId + '&role=1&questionOrderId='+data.id)">继续问诊</view>
				<view class="info3 info3-red" v-if="data.oStatus==3" >等待用户支付</view>
				<view class="info3 info3-red" v-if="data.qStatus==2&&data.recipeStatus==0" >等待药师审核处方</view>
				<view class="info3 info3-green" v-if="data.qStatus==2&&data.recipeStatus==1" >药师审方通过</view>
				<view class="info3 info3-red" v-if="data.qStatus==2&&data.recipeStatus==4" >药师审方未通过</view>
				
			</view>
		</view>
	</view>
</template>

<script>
import { currentImInfo } from '@/utils/token.js'
export default {
	props: {
		value: {
			type: Number | String,
			default: 0
		},
		data: {
			type: Object,
			default() {
				return {};
			}
		}
	},

	data() {
		return {};
	},
	onLoad(option) {},
	onShow() {},
	methods: {
		onEnd(){
			uni.showModal({
				title: '确认要结束问诊吗？',
				success: res => {
					if (res.confirm) {
						this.$api
							.manualUpdateQuestionStatus({
								params: {
									id: this.data.id
								}
							})
							.then(res => {
								if (res.code == 200) {
									this.$emit('paySuccess');
								} else {
									uni.showToast({
										title: res.message,
										icon: 'none'
									});
								}
							});
					}
				}
			});
		},
	}
};
</script>

<style lang="less">
	.doctor-inquiry-order-item {
		width: 686rpx;
		border-radius: 16rpx;
		background-color: rgba(255, 255, 255, 1);
		box-shadow: 0px 2rpx 10rpx 0px rgba(0, 0, 0, 0.1);
		box-sizing: border-box;
		padding: 20rpx 30rpx;
		margin-bottom: 20rpx;
	
		.outer4 {
			display: flex;
			align-items: center;
			border-bottom: 1rpx solid #eeeeee;
			padding-bottom: 10rpx;
			margin-bottom: 19rpx;
			.mod4 {
				height: 60rpx;
				border-radius: 50%;
				width: 60rpx;
				display: flex;
				flex-direction: column;
			}
	
			.word4 {
				color: rgba(51, 51, 51, 1);
				font-size: 28rpx;
				font-family: PingFangSC-Medium;
				margin-left: 16rpx;
			}
			.word5 {
				color: rgba(153, 153, 153, 1);
				font-size: 24rpx;
				font-family: PingFangSC-Regular;
				margin-left: 28rpx;
			}
			.info2 {
				color: rgba(35, 199, 156, 1);
				font-size: 28rpx;
				margin-left: auto;
			}
			
			.info2-green {
				color: #23c79c;
			}
			.info2-purple {
				color: #6E99C7;
			}
			.info2-gray {
				color: #999999;
			}
			.info2-red {
				color: #FF4141;
			}
		}
	
		.paragraph1 {
			color: rgba(51, 51, 51, 1);
			font-size: 28rpx;
			font-family: PingFangSC-Regular;
			margin-bottom: 10rpx;
		}
		.outer6 {
			margin-top: 10rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.txt2 {
				color: rgba(153, 153, 153, 1);
				font-size: 28rpx;
				font-family: PingFangSC-Regular;
			}
			.info3 {
				overflow-wrap: break-word;
				color: rgba(255, 65, 65, 1);
				font-size: 22rpx;
				
			}
			.info3-green {
				color: #23c79c;
				// border: 1rpx solid #23c79c;
				// background: #f7fffd;
			}
			.info3-purple {
				color: #6E99C7;
				border: 1rpx solid #6E99C7;
				background: #F9F7FF;
				width: 140rpx;
				height: 48rpx;
				border-radius: 25rpx;
				justify-content: center;
				align-items: center;
				display: flex;
			}
			.info3-gray {
				color: #999999;
				// border: 1rpx solid #999999;
				// background: #999999;
			}
			.info3-red {
				color: #FF4141;
				// border: 1rpx solid #FF4141;
				// background: #FF4141;
			}
		}
	}
		
		
</style>
